package cz.muni.fi.pa165.service.local;

import cz.muni.fi.pa165.dto.CustomerDTO;
import cz.muni.fi.pa165.dto.DeliveryDTO;
import cz.muni.fi.pa165.dto.EmployeeDTO;
import java.util.Date;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Ondrej Cernay
 */
@Local
public interface DeliveryServiceLocal {
    
    /**
     * 
     * @param delivery New delivery which will be stored in the DB
     * @return Long id of created delivery
     * @throws IllegalArgumentException if parameter is null
     */
    public Long createDelivery(DeliveryDTO delivery);
    
    /**
     * 
     * @param delivery Delivery which will updated in the DB
     * @throws IllegalArgumentException if parameter is null the id attribute is null
     */
    public void updateDelivery(DeliveryDTO delivery);
    
    /**
     * 
     * @param delivery Delivery which will be deleted from the DB
     * @throws IllegalArgumentException if parameter is null or the id attribute is null
     */
    public void removeDelivery(DeliveryDTO delivery);
    
    /**
     * 
     * @return List of all deliveries from the DB
     */
    public List<DeliveryDTO> getAllDeliveries();
    
    /**
     * 
     * @param deliveryBoy Employee instance
     * @return All deliveries that are assigned to the deliveryBoy
     * @throws IllegalArgumentException if the parameter is null or the employee's id is null
     */
    public List<DeliveryDTO> getDeliveriesByDeliveryBoy(EmployeeDTO deliveryBoy);
    
    /**
     * 
     * @param customer Customer instance
     * @return List of deliveries from the specified customer
     * @throws IllegalArgumentException if the parameter is null or customer's id is null
     */
    public List<DeliveryDTO> getDeliveriesByCustomer(CustomerDTO customer);
    
    /**
     * 
     * @param from Start of the search period
     * @param to End of the search period
     * @return List of deliveries delivered in the specified period
     * @throws IllegalArgumentException if any of the parameters is null or date from is greater than date to.
     */
    public List<DeliveryDTO> getDeliveriesByDeliveryDate(Date from, Date to);
    
    /**
     * 
     * @param from Start of the search period
     * @param to End of the search period
     * @return List of deliveries created in the specified period
     * @throws IllegalArgumentException if any of the parameters is null or date from is greater than date to.
     */
    public List<DeliveryDTO> getDeliveriesByCreationDate(Date from, Date to);
    
    /**
     * 
     * @param name Part of the recipient's name
     * @return List of deliveries delivered to a recipient with name containing the parameter
     * @throws IllegalArgumentException if the parameter is null
     */
    public List<DeliveryDTO> getDeliveriesByRecipient(String name);
    
    /**
     * @param address Part of a street name
     * @return List of deliveries delivered to an address containing the parameter
     * @throws IllegalArgumentException if the parameter is null
     */
    public List<DeliveryDTO> getDeliveriesByAddress(String address);
    
    /**
     * 
     * @param zip Zip code
     * @return List of deliveries delivered to specified ZIP code
     * @throws IllegalArgumentException if the parameter is null
     */
    public List<DeliveryDTO> getDeliveriesByZip(String zip);
    
    /**
     * 
     * @param city Part of city name
     * @return List of deliveries delivered to the city containing the parameter
     * @throws IllegalArgumentException if the parameter is null
     */
    public List<DeliveryDTO> getDeliveriesByCity(String city);
    
    /**
     * 
     * @param id Delivery id
     * @return Delivery with the given id
     */
    public DeliveryDTO getDeliveryById(Long id);
}
